import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:body_measurement/common/global.dart';
import 'package:body_measurement/models/task_data_source.dart';
import 'package:body_measurement/pages/home.dart';
import 'package:body_measurement/pages/login.dart';
import 'package:body_measurement/pages/task_detail.dart';

void main() {
  Global.init().then((e) => runApp(const MyApp()));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => TaskDataSource()),
      ],
      child: MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
          useMaterial3: true,
        ),
        routes: {
          '/': (context) => const HomePage(),
          'login_page': (context) => const LoginPage(),
          'task_detail_page': (context) => const TaskDetailPage(),
        },
        initialRoute: 'login_page',
      ),
    );
  }
}
